package com.bjc.core.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bjc.base.core.BaseServiceImpl;
import com.bjc.base.core.IBaseDao;
import com.bjc.core.bean.request.LookupItemReqVO;
import com.bjc.core.bean.response.LookupItemVO;
import com.bjc.core.dao.ILookupItemDao;
import com.bjc.core.service.ILookupItemService;

/**
 * lookupItem业务实现类
 * 
 * @author 许自辉
 * @date 2017年7月24日 下午3:35:08
 */
@Service
public class LookupItemImpl extends BaseServiceImpl<LookupItemReqVO, LookupItemVO> implements ILookupItemService {

	private ILookupItemDao lookupItemDao;

	@Autowired
	@Override
	public void setBaseDao(IBaseDao<LookupItemReqVO, LookupItemVO> baseDao) {
		this.baseDao = baseDao;
		this.lookupItemDao = (ILookupItemDao) baseDao;
	}

	@Override
	public int insert(LookupItemReqVO record) {
		LookupItemReqVO lookup = new LookupItemReqVO();
//		lookup.setCode(record.getCode());
		lookup.setItemCode(record.getItemCode());
		LookupItemVO reLookup = lookupItemDao.get(record);
		if (null == reLookup) {
			return lookupItemDao.insert(record);
		} else {
			return -1;
		}
	}

}
